package nimbus.utils
{
	import flash.utils.getQualifiedClassName;
	
	public function detectSingletonInstantiation(classObject:Object):void
	{
		if (!(classObject is Class))
		{
			classObject = classObject.constructor;
		}
		
		if (getSingletonByDefinition(classObject as Class) !== true)
		{
			throw new Error(getQualifiedClassName(classObject).split("::").pop() + " is a " + 
					"Singleton class and can only be instantiated through the getInstance " + 
					"function or the instance property.");
		}
	}
}